package com.wsx.ones.boots.service;

import com.wsx.ones.proto.WebGrpc;
import com.wsx.ones.proto.WebService;
import io.grpc.stub.StreamObserver;

/**
 * @author wangshuaixin
 * @Title: com.wsx.ones.boots.service.WebServiceImpl
 * @Description: 实现protobuf的实现服务
 * @date 2019/05/20
 */
public class WebServiceImpl extends WebGrpc.WebImplBase {

    @Override
    public void service(WebService.Request request, StreamObserver<WebService.Response> responseObserver) {

        System.out.println(request.getId() + "==" + request.getContent());

        WebService.Response response = WebService.Response.newBuilder().setCode(200).setMsg("成功").build();

        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }
}
